<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>首页</title>
		<meta name="Description" content="" />
		<meta name="Keywords" content="" />
		<meta name="format-detection" content="telephone=no, email=no" />
		<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
		<!-- 忽略页面中的数字识别为电话，忽略email识别 -->
		<meta name="applicable-device" content="mobile" />
		<meta name="apple-mobile-web-app-title" content="" />
		<!-- 添加到主屏后的标题（iOS 6 新增） -->
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<!-- 是否启用 WebApp 全屏模式 -->
		<meta name="HandheldFriendly" content="true" />
		<!-- 针对手持设备优化，主要是针对一些老的不识别viewport的浏览器，比如黑莓 -->
		<meta name="author" content="Jack" />
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<script src="js/flexible.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="style/jquery_css/weui.css" />
		<link rel="stylesheet" type="text/css" href="style/jquery_css/jquery-weui.css" />
		<link rel="stylesheet" type="text/css" href="style/car.css" />
		<link rel="stylesheet" type="text/css" href="style/icon_font/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="style/swiper/swiper.min.css" />
		<link rel="stylesheet" type="text/css" href="style/pub_foot.css" />
	</head>

	<body>
		<div class="min-box">
			<div class="search-max-box">
				<div class="header-search">
					<div class="search-box" onClick="window.location.href='search.html'">
						<i class="iconfont icon-Group- search-icon"></i>
						<span class="search-font">搜索</span>
					</div>
				</div>
			</div>

			<div class="top-main-div">
				<div class="swiper-box">
					<div class="swiper-container" style="width: 92%;">
						<div class="swiper-wrapper" id="banner-index"></div>
						<!-- 如果需要分页器 -->
						<div class="swiper-pagination"></div>

						<!-- 如果需要导航按钮 -->
						<!--<div class="swiper-button-prev"></div>
						    <div class="swiper-button-next"></div>-->
					</div>
				</div>

				<div class="classify-nav">
					<ul class="classify-ul"></ul>
				</div>

				<div id="hot-car"></div>

				<div class="postion-foot">
					<ul class="bottom-nav">
						<li>
							<a href="page/index/index.html">
								<img src="images/index.png" class="index-img" />
								<div class="active-color">首页</div>
							</a>
						</li>
						<li>
							<a href="page/website/website.html">
								<img src="images/site-1.png" class="site-img" />
								<div>网点</div>
							</a>

						</li>
						<li>
							<a href="page/my/my.html">
								<img src="images/my-1.png" class="my-img" />
								<div>个人中心</div>
							</a>

						</li>
					</ul>
				</div>

			</div>
		</div>
	</body>
	<script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/weiUI/jquery-weui.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/api/api_url.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/api/port_url.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/swiper/swiper.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/md5/access.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		$(function() {
			main_obj.index_fn();
		})

		var main_obj = {
			index_fn: function() {
				$.ajax({
					url: config_URL.api + URL.goodsIndex, //请求的url地址
					dataType: "json", //返回格式为json
					data: {
						access_token: '6de687d898834bf3bf6c04ba278c1c07'
					},
					type: "POST", //请求方式
					success: function(res) {
						console.log(res)
						if(res.code == 0) {
							var bannerList = res.data.bannerList;
							var goodsCatList = res.data.goodsCatList;
							//$.hideLoading();
							var banner_html = '';
							var goodsCat_html = '';
							var goods_list_html = '';
							var tit_html = '';
							for(var i in bannerList) {

								banner_html += '<div class="swiper-slide"><img src="http://as.hqhyqc.com' + bannerList[i].img + '" /></div>'
							}
							$('#banner-index').html(banner_html);

							var mySwiper = new Swiper('.swiper-container', {
								autoplay: true, //等同于以下设置
								loop: true, // 循环模式选项				
								// 如果需要分页器
								pagination: {
									el: '.swiper-pagination',
								},

								// 如果需要前进后退按钮
								//		    navigation: {
								//		      nextEl: '.swiper-button-next',
								//		      prevEl: '.swiper-button-prev',
								//		    }		    
							})
							
							
							var tit_html='';
							for(var j in goodsCatList){
								var banner_item = goodsCatList[j].goodslist;
								if(banner_item.length == 0){
									tit_html+=''
								}else{
									tit_html+= '<div class="hot-car-type"><div class="hot-car-tit">' + goodsCatList[j].title + '</div><div class="hot-car-box">';
								}
								
								for(var k in banner_item) {
									tit_html +=
									'							<div class="hot-item" onclick="main_obj.goods_details('+banner_item[k].id+')">'+
									'								<div class="car-type-img"><img src="http://as.hqhyqc.com'+banner_item[k].img+'" /></div>'+
									'								<div class="car-info-list">'+
									'									<div class="car-name">'+banner_item[k].title+'</div>'+
									'									<div class="car-introduce">'+banner_item[k].ftitle+'</div>'+
									'									<div class="car-pic">￥'+figureChange(banner_item[k].money)+'</div>'+
									'								</div>'+
									'					</div>';
								}
								tit_html+='</div></div>';
								goodsCat_html += '<li onclick="main_obj.search_classify('+goodsCatList[j].id+')"><img src="http://as.hqhyqc.com' + goodsCatList[j].img + '" alt="" /><div>' + goodsCatList[j].title + '</div></li>'
							}
							
							
							
																			
							$('.classify-ul').html(goodsCat_html);
							$('#hot-car').html(tit_html);

						} else {
							$.toast(res.msg, "text");
						}

					},
					error: function(rul) {
						console.log('网络出错')
					}
				});
			},
			search_classify:function(id){
				window.location.href='search.html?catid='+ id
			},
			goods_details(gid){
				window.location.href='car_details.html?gid='+ gid
			}

		}
	</script>
	<script type="text/javascript">
	</script>

</html>